package jtg.parser;

import java.util.ArrayList;
import java.util.List;

class ExpressionNode {
    String value;
    List<ExpressionNode> children;
    int id;

    public ExpressionNode(String value, int id) {
        this.value = value;
        this.children = new ArrayList<>();
        this.id = id;
    }

    // 添加子节点
    public void addChild(ExpressionNode child) {
        children.add(child);
    }

    // 打印树结构，用于调试
    public void printTree(String indent) {
        System.out.println(indent + id + ": " + value);
        children.forEach(child -> child.printTree(indent + "  "));
    }
}